<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>注册页面</title>

  <link rel="stylesheet" type="text/css" th:href="@{/static/lib/layui-v2.6.3/css/layui.css}"/>
  <script type="text/javascript" th:src="@{/static/lib/jquery-3.4.1/jquery-3.4.1.min.js}"></script>
  <script type="text/javascript" th:src="@{/static/lib/layui-v2.6.3/layui.js}"></script>
</head>
<body>
<style>
    *{
        margin: 0px;/*所有的外边距为0*/
        padding: 0px;/*所有的内边距为0*/
        box-sizing: border-box;/*规定两个并排的带边框的框*/
    }
    body{
        padding-top: 25px;
    }
    .rg_layout{
        width: 900px;
        height: 500px;
        border: 8px solid #EEEEEE;/*solid 定义实线*/
        background-color: white;
        margin: auto;
    }
    .rg_left{
        float: left;
        margin: 15px;
    }
    .rg_left>p:first-child{
        color: #FFD026;
        font-size: 20px;
    }
    .rg_left>p:last-child{
        color: #A6A6A6;
        font-size: 20px;
    }

    .rg_center{
        float: left;
    }

    .rg_right{
        float: right;
        margin: 15px;
        padding-left: 50px;
    }
    .rg_right p{
        font-size: 15px;
    }
    .rg_right p a{
        color: coral;
    }
    .td_left{
        width: 100px;
        text-align: right;
        height: 45px;
    }
    .td_right{
        padding-left: 50px;
    }
    #username,#password,#password1,#email,#name,#tel,#birthday,#checkcode{
        width: 251px;
        height: 32px;
        border: 1px solid #A6A6A6;
        /*设置边框圆角*/
        border-radius: 5px;
        padding-left: 10px;
    }
    #checkcode{
        width: 110px;
    }
    #img_check{
        height: 32px;
        vertical-align: middle;/*设置图片的位置垂直居中*/
    }
    #btn_sub{
        width: 100px;
        height: 40px;
        background-color: #FFD026;
        border: 1px solid #FFD026;
        padding-left: 10px;
    }

</style>
<div class="rg_layout">
  <div class="rg_left">
    <p>新用户注册</p>
    <p>USER REGISTER</p>
  </div>
  <div class="rg_center">
    <div class="rg_form">
      <form action="add" method="post">
        <table style="margin-top:100px">
          <tr><!--label 标签的作用是当点击文字也会跳到文本输出框-->
            <!--for属性与ID属性对应规定 label 绑定到哪个表单元素。-->
            <td class="td_left"><label for="username">手机号</label> </td>
            <td class="td_right"><input type="text" name="userPhone" id="username"> </td>
          </tr>
          <tr>
            <td class="td_left"><label for="password">密码</label> </td>
            <td class="td_right"><input type="password" name="userPass"id="password1" > </td>
          </tr>
          <tr>
            <td class="td_left"><label for="password">确认密码</label> </td>
            <td class="td_right"><input type="password" name="" id="password"> </td>
          </tr>
        </table>
      </form>
          <tr>
            <td colspan="2" align="center">
              <input type="button" th:onclick="add()" value="注册" id="btn_sub" style="margin-left:200px">
            </td>
          </tr>



    </div>
  </div>
  <div class="rg_right">
    <p>已有账号？<a href="login">立即登录</a></p>
  </div>
</div>
</body>
<script>
  function add(){
  var pass1=$("#password1").val();
  var pass2=$("#password").val();
 if(pass1!=pass2){
  alert("两次密码不一样！");
  return;
 }
 <!--验证手机号是否合法-->
 var regs= /^1[3456789]\d{9}$/;
 var phone=$("#username").val();
 if(!regs.test(phone)){
 alert("手机号码不合法请重新输入！");
  return;
 }
   var params = $("form").serialize();
 window.location.href = "/user/add?"+params;

  }
</script>
</html>